#include <iostream>
#include "Mythread.hpp"
#include <unistd.h>
#include <pthread.h>

static int nums=1;

void *Routine()
{
    //pthread_detach(pthread_self());
    std::string num=std::to_string(nums++);
    int cut=3;
    while(cut--)
    {
        std::cout<<num<<":"<<"thread do success "<<cut<<std::endl;
    }    
    return nullptr;
}

void thread_test()
{
    int cut=1;
    Mythread Myt(Routine);
    while(cut--)
    {
        Myt.Start();
        //Myt.IsRunning();
        //Myt.IsRunning;
        sleep(1);
    }
    sleep(5);
    std::cout<<Myt.GetStartTime()<<std::endl;
    std::cout<<Myt.GetRunTime()<<std::endl;

    cut=1;
    // while(cut--)
    // {
    //     Myt.Join();
    // }
    Myt.Join();
    //sleep(5);
    //std::cout<<Myt.GetTime()<<std::endl;
}


int main()
{
    thread_test();
    return 0;
}